/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package structures;

import java.util.ArrayList;
import java.util.Arrays;

/**
 *
 * @author Slayer
 */
public class ExtendedList<T extends Cloneable> extends ArrayList<T> {

    public boolean add(T... items) {
        return addAll(Arrays.asList(items));
    }

    public ExtendedList(T... items) {
        addAll(Arrays.asList(items));
    }

    public ExtendedList() {
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }

        final ExtendedList<T> other = (ExtendedList<T>) obj;

        if (size() != other.size()) {
            return false;
        }

        for (int index = 0; index < size(); ++index) {
            if (!get(index).equals(other.get(index))) {
                return false;
            }
        }

        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        return hash;
    }

    @Override
    public String toString() {
        final StringBuilder builder = new StringBuilder();

        for (T item : this) {
            builder.append(item.toString());
        }

        return builder.toString();
    }
}
